<script type="text/javascript">//<![CDATA[
	XHR.poll(5, '<%=url("admin/services/daed-next/status")%>', null,
		function(x, data)
		{
			var tb = document.getElementById('daed-next_status');
			if (data && tb)
			{
				if (data.running)
				{
					tb.innerHTML = '<em style=\"color:green\"><b><%:dae-wing%> <%:RUNNING%></b></em>';
				}
				else
				{
					tb.innerHTML = '<em style=\"color:red\"><b><%:dae-wing%> <%:NOT RUNNING%></b></em>';
				}
			}
		}
	);
//]]></script>

<script type="text/javascript">//<![CDATA[
	XHR.poll(5, '<%=url("admin/services/daed-next/dashboardstatus")%>', null,
    function(x, data) {
        console.log('Received data:', data);

        var dashboardstatus = document.getElementById('daed-next_dashboardstatus');
        var dashboardPidExists = <%=luci.sys.exec("[ -e '/tmp/log/daed-next/dashboard.pid' ] && echo '1' || echo '0'")%>;

        if (dashboardPidExists) {
            dashboardstatus.innerHTML = '<em style=\"color:green\"><b><%:Dashboard%> <%:RUNNING%></b></em>';
        } else {
            dashboardstatus.innerHTML = '<em style=\"color:red\"><b><%:Dashboard%> <%:NOT RUNNING%></b></em>';
        }
    }
);
//]]></script>

<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
	<p id="daed-next_status">
		<em><b><%:Collecting data...%></b></em>
	</p>
	<p id="daed-next_dashboardstatus">
		<em><b><%:Collecting data...%></b></em>
	</p>
</fieldset>
